#!/usr/bin/python
# -*- coding: utf-8 -*-



import os
import sys
from PyQt4 import QtCore, QtGui
from Main import *
import re
from DAC.BatimentDAC import Batiment
from DAC.AccessPointDAC import AccessPoint
from DAC.SalleDAC import Salle
from gestion import *

class Page4(object):
    
    def __init__(self,session):
		self.session=session
		self.app = QtGui.QApplication(sys.argv)
		self.window=QtGui.QDialog()
                self.parametre={}
                self.config={}
                self.error=1
                
    def recup_dico(self,filename):
        fichier=open(filename,'r')
        expr=re.compile("[A-Za-z]")
        for line in fichier.readlines():
           if expr.findall(line):
               self.parametre[line.split(":")[0].split("\n")[0]]=line.split(":")[1].split("\n")[0]
        fichier.close()
       

    def suivant(self):
       indexAP = self.comboBox_AP_existants.currentIndex()
       indexSA = self.comboBox_emplacement.currentIndex()

       self.dico["nom"] = self.lineEdit_nom_vide.displayText()
       self.dico["mac"] = self.lineEdit_addrmac_vide.displayText()
       self.dico["x"] = int(self.doubleSpinBox_x_number.value())
       self.dico["y"] = int(self.doubleSpinBox_y_number.value())
       self.dico["z"] = int(self.doubleSpinBox_z_number.value())
       self.dico["essid"] = self.lineEdit_essid_vide.displayText()
       self.dico["mobile"] = self.radioButton_mobile.isChecked()
       self.dico["cryptage"] = self.comboBox_cryptage.currentText()
       self.dico["dhcp"] = self.comboBox_dhcp.currentText()
       self.dico["geodescription"] = self.textEdit_desc_ap.toPlainText()
      
       ap = AccessPoint()
       if(indexAP < 2):
		ap.createByDico(self.dico)
		ap.insertToDb(self.listSA[indexSA-1]["ID"])
       else:
		ap = AccessPoint(self.listAP[indexAP-2]["ID"])
		ap.createByDico(self.dico)
		ap.updateIntoDb(self.listSA[indexSA-1]["ID"])

       file=open("dicoaccesspoint","a")
       file.write("\nnom:"+self.dico["nom"])
       file.write("\nmac:"+self.dico["mac"])
       file.write("\nx:"+str(self.dico["x"]))
       file.write("\ny:"+str(self.dico["y"]))
       file.write("\nz:"+str(self.dico["z"]))
       file.write("\nessid:"+self.dico["essid"])
       file.write("\nmobile:"+str(self.dico["mobile"]))
       file.write("\nid:"+ap.id["value"])
       file.write("\ncryptage:"+self.dico["cryptage"])
       file.write("\ndhcp:"+self.dico["dhcp"])
       file.write("\ngeodescription:"+self.dico["geodescription"])
       file.close()
       if self.comboBox_dhcp.currentText() == "NON" and self.comboBox_cryptage.currentText() == "WEP":

         config={} 
         config["essid"]=self.lineEdit_essid_vide.displayText()
         config["dhcp"]="0"
         config["cryptage"]="wep"
         config["cle"]=self.lineEdit_CLE_vide.displayText()
         config["ip"]=self.lineEdit_IP_vide.displayText()
         config["masque"]=self.lineEdit_masque_vide.displayText()
         config["mac"]=""
         config["gw"]=""
         config["pilote"]=""    
         gestion2=Gestion("un")
         gestion2.config(config)

       if self.comboBox_dhcp.currentText() == "NON" and self.comboBox_cryptage.currentText() == "NON":

         config={} 
         config["essid"]=self.lineEdit_essid_vide.displayText()
         config["dhcp"]="0"
         config["cryptage"]=""
         config["cle"]=""
         config["ip"]=self.lineEdit_IP_vide.displayText()
         config["masque"]=self.lineEdit_masque_vide.displayText()
         config["mac"]=""
         config["gw"]=""
         config["pilote"]=""    
         gestion2=Gestion("un")
         gestion2.config(config)
     
       if self.comboBox_dhcp.currentText() == "OUI" and self.comboBox_cryptage.currentText() == "NON":

         config={} 
         config["essid"]=self.lineEdit_essid_vide.displayText()
         config["dhcp"]="1"
         config["cryptage"]=""
         config["cle"]=""
         config["ip"]=""
         config["masque"]=""
         config["mac"]=""
         config["gw"]=""
         config["pilote"]=""    
         gestion2=Gestion("un")
         gestion2.config(config)

       if self.comboBox_dhcp.currentText() == "OUI" and self.comboBox_cryptage.currentText() == "WEP":

         config={} 
         config["essid"]=self.lineEdit_essid_vide.displayText()
         config["dhcp"]="1"
         config["cryptage"]="wep"
         config["cle"]=self.lineEdit_CLE_vide.displayText()
         config["ip"]=""
         config["masque"]=""
         config["mac"]=""
         config["gw"]=""
         config["pilote"]=""    
         gestion2=Gestion("un")
         gestion2.config(config)
     

            
     #    print "else"
       self.window.close() 
         
       obj5=Main()
       obj5.func5(self.config)
    def displayAccessPoint(self):
	
	indexAP = self.comboBox_AP_existants.currentIndex()
	if indexAP >= 2	:
		self.lineEdit_nom_vide.setText(self.listAP[indexAP-2]["nom"])
		self.lineEdit_essid_vide.setText(self.listAP[indexAP-2]["essid"])
		self.lineEdit_addrmac_vide.setText(self.listAP[indexAP-2]["mac"])
		self.doubleSpinBox_x_number.setValue(self.listAP[indexAP-2]["x"])
		self.doubleSpinBox_y_number.setValue(self.listAP[indexAP-2]["y"])
		self.doubleSpinBox_z_number.setValue(self.listAP[indexAP-2]["z"])
		self.textEdit_desc_ap.setText(self.listAP[indexAP-2]["geodescription"])
		if self.listAP[indexAP-2]["mobile"] == "True":
			self.radioButton_mobile.setChecked(1)
                        self.lineEdit_nom_vide.setReadOnly(True)
                        self.lineEdit_addrmac_vide.setReadOnly(True)
                        self.textEdit_desc_ap.setReadOnly(True)
                        
		else:
			self.radioButton_fixe.setChecked(1)
                        self.lineEdit_nom_vide.setReadOnly(True)
                        self.lineEdit_addrmac_vide.setReadOnly(True)
                        self.textEdit_desc_ap.setReadOnly(True)
                        self.doubleSpinBox_x_number.setReadOnly(True)
                        self.doubleSpinBox_y_number.setReadOnly(True)
                        self.doubleSpinBox_z_number.setReadOnly(True)

		if self.listAP[indexAP-2]["cryptage"] == "wep":
			self.comboBox_cryptage.setCurrentIndex(1)
		else:
			self.comboBox_cryptage.setCurrentIndex(2)
		
		if self.listAP[indexAP-2]["dhcp"] == "OUI":
			self.comboBox_dhcp.setCurrentIndex(1)
		else:
			self.comboBox_dhcp.setCurrentIndex(2)

		i = 1
		for SA in self.listSA:
			if(self.listAP[indexAP-2]["link_sa"] == SA["ID"]):
				self.comboBox_emplacement.setCurrentIndex(i)
			i = i+1;
	else:
		self.lineEdit_nom_vide.setText("")
		self.lineEdit_essid_vide.setText("")
		self.lineEdit_addrmac_vide.setText("")
		self.doubleSpinBox_x_number.setValue(0.0)
		self.doubleSpinBox_y_number.setValue(0.0)
		self.doubleSpinBox_z_number.setValue(0.0)
		self.radioButton_mobile.setChecked(0)
		self.radioButton_fixe.setChecked(0)
		self.comboBox_emplacement.setCurrentIndex(0)
		self.comboBox_cryptage.setCurrentIndex(0)
		self.comboBox_dhcp.setCurrentIndex(0)
		self.textEdit_desc_ap.setText("")
                self.lineEdit_nom_vide.setReadOnly(False)
                self.lineEdit_addrmac_vide.setReadOnly(False)
                self.textEdit_desc_ap.setReadOnly(False)
                self.doubleSpinBox_x_number.setReadOnly(False)
                self.doubleSpinBox_y_number.setReadOnly(False)
                self.doubleSpinBox_z_number.setReadOnly(False)
    def fixe(self):
                self.doubleSpinBox_x_number.setReadOnly(True)
                self.doubleSpinBox_y_number.setReadOnly(True)
                self.doubleSpinBox_z_number.setReadOnly(True)
    def newAP(self):
        pass
    def mobile(self):
                self.doubleSpinBox_x_number.setReadOnly(False)
                self.doubleSpinBox_y_number.setReadOnly(False)
                self.doubleSpinBox_z_number.setReadOnly(False)
    def nouvelAP(self):
        self.pushButton_Nouvel_AP.setVisible(True)
    def emplacement(self):
        pass
    def cryptage(self):
       self.config["cryptage"]=self.comboBox_cryptage.currentText()
       file=open("dicoaccesspoint","a")
       file.write("\ncryptage:"+self.comboBox_cryptage.currentText())
       file.close()
       if self.comboBox_cryptage.currentText() == "wep":
         self.lineEdit_CLE_vide.setVisible(True)
         self.lineEdit_CLE.setVisible(True)
       if self.comboBox_cryptage.currentText() == "NON":
         self.lineEdit_CLE_vide.setVisible(False)
         self.lineEdit_CLE.setVisible(False)

    def dhcp(self):
       self.config["dhcp"]=self.comboBox_dhcp.currentText()
       file=open("dicoaccesspoint","a")
       file.write("\ndhcp:"+self.comboBox_dhcp.currentText())
       file.close() 
       if self.comboBox_dhcp.currentText() == "NON":
            self.lineEdit_masque_vide.setVisible(True) 
            self.lineEdit_IP_vide.setVisible(True)
            self.lineEdit_IP.setVisible(True)
            self.lineEdit_masque.setVisible(True)


       if self.comboBox_dhcp.currentText() == "OUI":
            self.lineEdit_masque_vide.setVisible(False) 
            self.lineEdit_IP_vide.setVisible(False)
            self.lineEdit_IP.setVisible(False)
            self.lineEdit_masque.setVisible(False)








            
    def annuler(self):
        pass
	
    def retour(self):
        self.window.close()
        os.system("./launch_page3.py")

     
	       
    def affich(self,param):
        os.system("echo>dicoaccesspoint")
        self.parametre=param
	self.setupUi(self.window)
	self.window.show()
 	sys.exit(self.app.exec_())


    def setupUi(self, Dialog):

	self.dico ={}
	self.parametre={}
	self.recup_dico("dicobatiment")
	batiment = Batiment(self.parametre["id"])

        Dialog.setObjectName("Dialog")
        Dialog.resize(1440, 825)
        self.lineEdit_access_point = QtGui.QLineEdit(Dialog)
        self.lineEdit_access_point.setGeometry(QtCore.QRect(410, 10, 481, 65))
        font = QtGui.QFont()
        font.setFamily("Bitstream Charter")
        font.setPointSize(32)
        font.setWeight(50)
        font.setBold(False)
        self.lineEdit_access_point.setFont(font)
        self.lineEdit_access_point.setAlignment(QtCore.Qt.AlignCenter)
        self.lineEdit_access_point.setReadOnly(True)
        self.lineEdit_access_point.setObjectName("lineEdit_access_point")
        self.lineEdit_coordonnees_relatives = QtGui.QLineEdit(Dialog)
        self.lineEdit_coordonnees_relatives.setGeometry(QtCore.QRect(20, 530, 311, 41))
        font = QtGui.QFont()
        font.setFamily("Bitstream Charter")
        font.setPointSize(14)
        self.lineEdit_coordonnees_relatives.setFont(font)
        self.lineEdit_coordonnees_relatives.setAlignment(QtCore.Qt.AlignCenter)
        self.lineEdit_coordonnees_relatives.setReadOnly(True)
        self.lineEdit_coordonnees_relatives.setObjectName("lineEdit_coordonnees_relatives")
        self.lineEdit_desc_ap = QtGui.QLineEdit(Dialog)
        self.lineEdit_desc_ap.setGeometry(QtCore.QRect(20, 600, 771, 41))
        font = QtGui.QFont()
        font.setFamily("Bitstream Charter")
        font.setPointSize(14)
        font.setItalic(False)
        self.lineEdit_desc_ap.setFont(font)
        self.lineEdit_desc_ap.setAutoFillBackground(False)
        self.lineEdit_desc_ap.setAlignment(QtCore.Qt.AlignCenter)
        self.lineEdit_desc_ap.setReadOnly(True)
        self.lineEdit_desc_ap.setObjectName("lineEdit_desc_ap")
        self.pushButton_suivant = QtGui.QPushButton(Dialog)
        self.pushButton_suivant.setGeometry(QtCore.QRect(1120, 760, 141, 41))
        font = QtGui.QFont()
        font.setFamily("Bitstream Charter")
        font.setPointSize(12)
        self.pushButton_suivant.setFont(font)
        self.pushButton_suivant.setObjectName("pushButton_suivant")
        self.lineEdit_x = QtGui.QLineEdit(Dialog)
        self.lineEdit_x.setGeometry(QtCore.QRect(360, 530, 51, 41))
        font = QtGui.QFont()
        font.setFamily("Bitstream Charter")
        font.setPointSize(14)
        self.lineEdit_x.setFont(font)
        self.lineEdit_x.setAlignment(QtCore.Qt.AlignCenter)
        self.lineEdit_x.setReadOnly(True)
        self.lineEdit_x.setObjectName("lineEdit_x")
        self.lineEdit_y = QtGui.QLineEdit(Dialog)
        self.lineEdit_y.setGeometry(QtCore.QRect(580, 530, 51, 41))
        font = QtGui.QFont()
        font.setFamily("Bitstream Charter")
        font.setPointSize(14)
        self.lineEdit_y.setFont(font)
        self.lineEdit_y.setAlignment(QtCore.Qt.AlignCenter)
        self.lineEdit_y.setReadOnly(True)
        self.lineEdit_y.setObjectName("lineEdit_y")
        self.lineEdit_z = QtGui.QLineEdit(Dialog)
        self.lineEdit_z.setGeometry(QtCore.QRect(770, 530, 51, 41))
        font = QtGui.QFont()
        font.setFamily("Bitstream Charter")
        font.setPointSize(14)
        self.lineEdit_z.setFont(font)
        self.lineEdit_z.setAlignment(QtCore.Qt.AlignCenter)
        self.lineEdit_z.setReadOnly(True)
        self.lineEdit_z.setObjectName("lineEdit_z")
        self.doubleSpinBox_x_number = QtGui.QDoubleSpinBox(Dialog)
        self.doubleSpinBox_x_number.setGeometry(QtCore.QRect(410, 530, 91, 41))
        font = QtGui.QFont()
        font.setFamily("Bitstream Charter")
        font.setPointSize(14)
        self.doubleSpinBox_x_number.setFont(font)
        self.doubleSpinBox_x_number.setAlignment(QtCore.Qt.AlignCenter)
        self.doubleSpinBox_x_number.setMinimum(-1000.0)
        self.doubleSpinBox_x_number.setMaximum(1000.0)
        self.doubleSpinBox_x_number.setObjectName("doubleSpinBox_x_number")
        self.doubleSpinBox_y_number = QtGui.QDoubleSpinBox(Dialog)
        self.doubleSpinBox_y_number.setGeometry(QtCore.QRect(630, 530, 91, 41))
        font = QtGui.QFont()
        font.setFamily("Bitstream Charter")
        font.setPointSize(14)
        self.doubleSpinBox_y_number.setFont(font)
        self.doubleSpinBox_y_number.setAlignment(QtCore.Qt.AlignCenter)
        self.doubleSpinBox_y_number.setMinimum(-1000.0)
        self.doubleSpinBox_y_number.setMaximum(1000.0)
        self.doubleSpinBox_y_number.setProperty("value", QtCore.QVariant(0.0))
        self.doubleSpinBox_y_number.setObjectName("doubleSpinBox_y_number")
        self.pushButton_precedent = QtGui.QPushButton(Dialog)
        self.pushButton_precedent.setGeometry(QtCore.QRect(930, 760, 171, 41))
        font = QtGui.QFont()
        font.setFamily("Bitstream Charter")
        font.setPointSize(12)
        self.pushButton_precedent.setFont(font)
        self.pushButton_precedent.setObjectName("pushButton_precedent")
        self.doubleSpinBox_z_number = QtGui.QDoubleSpinBox(Dialog)
        self.doubleSpinBox_z_number.setGeometry(QtCore.QRect(820, 530, 91, 41))
        font = QtGui.QFont()
        font.setFamily("Bitstream Charter")
        font.setPointSize(14)
        self.doubleSpinBox_z_number.setFont(font)
        self.doubleSpinBox_z_number.setAlignment(QtCore.Qt.AlignCenter)
        self.doubleSpinBox_z_number.setMinimum(-1000.0)
        self.doubleSpinBox_z_number.setMaximum(1000.0)
        self.doubleSpinBox_z_number.setObjectName("doubleSpinBox_z_number")
        self.lineEdit_adresse_mac = QtGui.QLineEdit(Dialog)
        self.lineEdit_adresse_mac.setGeometry(QtCore.QRect(20, 420, 201, 31))
        font = QtGui.QFont()
        font.setFamily("Bitstream Charter")
        font.setPointSize(14)
        self.lineEdit_adresse_mac.setFont(font)
        self.lineEdit_adresse_mac.setAlignment(QtCore.Qt.AlignCenter)
        self.lineEdit_adresse_mac.setReadOnly(True)
        self.lineEdit_adresse_mac.setObjectName("lineEdit_adresse_mac")
        self.lineEdit_nouvel_AP = QtGui.QLineEdit(Dialog)
        self.lineEdit_nouvel_AP.setGeometry(QtCore.QRect(20, 260, 311, 41))
        font = QtGui.QFont()
        font.setFamily("Bitstream Charter")
        font.setPointSize(14)
        self.lineEdit_nouvel_AP.setFont(font)
        self.lineEdit_nouvel_AP.setAlignment(QtCore.Qt.AlignCenter)
        self.lineEdit_nouvel_AP.setReadOnly(True)
        self.lineEdit_nouvel_AP.setObjectName("lineEdit_nouvel_AP")
        self.lineEdit_AP_existants = QtGui.QLineEdit(Dialog)
        self.lineEdit_AP_existants.setGeometry(QtCore.QRect(20, 150, 331, 31))
        font = QtGui.QFont()
        font.setFamily("Bitstream Charter")
        font.setPointSize(14)
        self.lineEdit_AP_existants.setFont(font)
        self.lineEdit_AP_existants.setAlignment(QtCore.Qt.AlignCenter)
        self.lineEdit_AP_existants.setReadOnly(True)
        self.lineEdit_AP_existants.setObjectName("lineEdit_AP_existants")
        self.pushButton_Nouvel_AP = QtGui.QPushButton(Dialog)
        self.pushButton_Nouvel_AP.setGeometry(QtCore.QRect(20, 760, 281, 41))
        font = QtGui.QFont()
        font.setFamily("Bitstream Charter")
        font.setPointSize(12)
        self.pushButton_Nouvel_AP.setFont(font)
        self.pushButton_Nouvel_AP.setObjectName("pushButton_Nouvel_AP")
        self.pushButton_Nouvel_AP.setVisible(False)
        self.lineEdit_type = QtGui.QLineEdit(Dialog)
        self.lineEdit_type.setGeometry(QtCore.QRect(600, 320, 101, 31))
        font = QtGui.QFont()
        font.setFamily("Bitstream Charter")
        font.setPointSize(14)
        self.lineEdit_type.setFont(font)
        self.lineEdit_type.setAlignment(QtCore.Qt.AlignCenter)
        self.lineEdit_type.setReadOnly(True)
        self.lineEdit_type.setObjectName("lineEdit_type")
        self.radioButton_fixe = QtGui.QRadioButton(Dialog)
        self.radioButton_fixe.setGeometry(QtCore.QRect(720, 320, 127, 25))
        font = QtGui.QFont()
        font.setFamily("Bitstream Charter")
        font.setPointSize(14)
        self.radioButton_fixe.setFont(font)
        self.radioButton_fixe.setObjectName("radioButton_fixe")
        self.radioButton_mobile = QtGui.QRadioButton(Dialog)
        self.radioButton_mobile.setGeometry(QtCore.QRect(820, 320, 127, 25))
        font = QtGui.QFont()
        font.setFamily("Bitstream Charter")
        font.setPointSize(14)
        self.radioButton_mobile.setFont(font)
        self.radioButton_mobile.setObjectName("radioButton_mobile")
        self.lineEdit_emplacement = QtGui.QLineEdit(Dialog)
        self.lineEdit_emplacement.setGeometry(QtCore.QRect(20, 470, 551, 41))
        font = QtGui.QFont()
        font.setFamily("Bitstream Charter")
        font.setPointSize(14)
        self.lineEdit_emplacement.setFont(font)
        self.lineEdit_emplacement.setAlignment(QtCore.Qt.AlignCenter)
        self.lineEdit_emplacement.setReadOnly(True)
        self.lineEdit_emplacement.setObjectName("lineEdit_emplacement")
        self.comboBox_emplacement = QtGui.QComboBox(Dialog)
        self.comboBox_emplacement.setGeometry(QtCore.QRect(590, 470, 431, 41))
        font = QtGui.QFont()
        font.setFamily("Bitstream Charter")
        self.comboBox_emplacement.setFont(font)
        self.comboBox_emplacement.setObjectName("comboBox_emplacement")
        self.comboBox_emplacement.addItem("...")
	
	self.listSA = batiment.selectSallesFromDB()
	for SA in self.listSA:
		 self.comboBox_emplacement.addItem(SA["nom"])

        self.lineEdit_essid_vide = QtGui.QLineEdit(Dialog)
        self.lineEdit_essid_vide.setGeometry(QtCore.QRect(240, 370, 341, 31))
        font = QtGui.QFont()
        font.setFamily("Bitstream Charter")
        font.setPointSize(14)
        self.lineEdit_essid_vide.setFont(font)
        self.lineEdit_essid_vide.setObjectName("lineEdit_essid_vide")
        self.comboBox_AP_existants = QtGui.QComboBox(Dialog)
        self.comboBox_AP_existants.setGeometry(QtCore.QRect(20, 200, 711, 31))
        font = QtGui.QFont()
        font.setFamily("Bitstream Charter")
	
	
	
        self.comboBox_AP_existants.setFont(font)
        self.comboBox_AP_existants.setObjectName("comboBox_AP_existants")
        self.comboBox_AP_existants.addItem("...")
        self.comboBox_AP_existants.addItem("nouvel Access point")
	
	self.listAP = batiment.selectAccessPointFromDB()
	print self.listAP
	for AP in self.listAP:
		 self.comboBox_AP_existants.addItem(AP["nom"])
        
        
        self.lineEdit_essid = QtGui.QLineEdit(Dialog)
        self.lineEdit_essid.setGeometry(QtCore.QRect(20, 370, 201, 31))
        font = QtGui.QFont()
        font.setFamily("Bitstream Charter")
        font.setPointSize(14)
        self.lineEdit_essid.setFont(font)
        self.lineEdit_essid.setAlignment(QtCore.Qt.AlignCenter)
        self.lineEdit_essid.setReadOnly(True)
        self.lineEdit_essid.setObjectName("lineEdit_essid")
        self.lineEdit_addrmac_vide = QtGui.QLineEdit(Dialog)
        self.lineEdit_addrmac_vide.setGeometry(QtCore.QRect(240, 420, 341, 31))
        font = QtGui.QFont()
        font.setFamily("Bitstream Charter")
        font.setPointSize(14)
        self.lineEdit_addrmac_vide.setFont(font)
        self.lineEdit_addrmac_vide.setObjectName("lineEdit_addrmac_vide")
        self.lineEdit_cryptage = QtGui.QLineEdit(Dialog)
        self.lineEdit_cryptage.setGeometry(QtCore.QRect(600, 360, 121, 36))
        font = QtGui.QFont()
        font.setFamily("Bitstream Charter")
        font.setPointSize(14)
        self.lineEdit_cryptage.setFont(font)
        self.lineEdit_cryptage.setAlignment(QtCore.Qt.AlignCenter)
        self.lineEdit_cryptage.setReadOnly(True)
        self.lineEdit_cryptage.setObjectName("lineEdit_cryptage")
        self.comboBox_cryptage = QtGui.QComboBox(Dialog)
        self.comboBox_cryptage.setGeometry(QtCore.QRect(740, 360, 81, 31))
        self.comboBox_cryptage.setObjectName("comboBox_cryptage")
        self.comboBox_cryptage.addItem("...")
        self.comboBox_cryptage.addItem("wep")
        self.comboBox_cryptage.addItem("NON")
        self.comboBox_dhcp = QtGui.QComboBox(Dialog)
        self.comboBox_dhcp.setGeometry(QtCore.QRect(740, 420, 81, 31))
        self.comboBox_dhcp.setObjectName("comboBox_dhcp")
        self.comboBox_dhcp.addItem("...")
        self.comboBox_dhcp.addItem("OUI")
        self.comboBox_dhcp.addItem("NON")
        self.lineEdit_dhcp = QtGui.QLineEdit(Dialog)
        self.lineEdit_dhcp.setGeometry(QtCore.QRect(600, 420, 121, 36))
        font = QtGui.QFont()
        font.setFamily("Bitstream Charter")
        font.setPointSize(14)
        self.lineEdit_dhcp.setFont(font)
        self.lineEdit_dhcp.setAlignment(QtCore.Qt.AlignCenter)
        self.lineEdit_dhcp.setReadOnly(True)
        self.lineEdit_dhcp.setObjectName("lineEdit_dhcp")
        self.lineEdit_nom_vide = QtGui.QLineEdit(Dialog)
        self.lineEdit_nom_vide.setGeometry(QtCore.QRect(240, 320, 341, 31))
        font = QtGui.QFont()
        font.setFamily("Bitstream Charter")
        font.setPointSize(14)
        self.lineEdit_nom_vide.setFont(font)
        self.lineEdit_nom_vide.setObjectName("lineEdit_nom_vide")
        self.lineEdit_nom = QtGui.QLineEdit(Dialog)
        self.lineEdit_nom.setGeometry(QtCore.QRect(20, 320, 201, 31))
        font = QtGui.QFont()
        font.setFamily("Bitstream Charter")
        font.setPointSize(14)
        self.lineEdit_nom.setFont(font)
        self.lineEdit_nom.setAlignment(QtCore.Qt.AlignCenter)
        self.lineEdit_nom.setReadOnly(True)
        self.lineEdit_nom.setObjectName("lineEdit_nom")
        self.textEdit_desc_ap = QtGui.QTextEdit(Dialog)
        self.textEdit_desc_ap.setGeometry(QtCore.QRect(20, 650, 901, 101))
        font = QtGui.QFont()
        font.setFamily("Bitstream Charter")
        font.setPointSize(12)
        self.textEdit_desc_ap.setFont(font)
        self.textEdit_desc_ap.setObjectName("textEdit_desc_ap")
        self.lineEdit_IP = QtGui.QLineEdit(Dialog)
        self.lineEdit_IP.setGeometry(QtCore.QRect(870, 360, 121, 36))
        font = QtGui.QFont()
        font.setFamily("Bitstream Charter")
        font.setPointSize(14)
        self.lineEdit_IP.setFont(font)
        self.lineEdit_IP.setAlignment(QtCore.Qt.AlignCenter)
        self.lineEdit_IP.setReadOnly(True)
        self.lineEdit_IP.setObjectName("lineEdit_IP")
        self.lineEdit_IP.setVisible(False)
        self.lineEdit_masque = QtGui.QLineEdit(Dialog)
        self.lineEdit_masque.setGeometry(QtCore.QRect(870, 420, 121, 36))
        font = QtGui.QFont()
        font.setFamily("Bitstream Charter")
        font.setPointSize(14)
        self.lineEdit_masque.setFont(font)
        self.lineEdit_masque.setAlignment(QtCore.Qt.AlignCenter)
        self.lineEdit_masque.setReadOnly(True)
        self.lineEdit_masque.setObjectName("lineEdit_masque")
        self.lineEdit_masque.setVisible(False)
        self.lineEdit_IP_vide = QtGui.QLineEdit(Dialog)
        self.lineEdit_IP_vide.setGeometry(QtCore.QRect(1010, 360, 141, 31))
        font = QtGui.QFont()
        font.setFamily("Bitstream Charter")
        font.setPointSize(14)
        self.lineEdit_IP_vide.setFont(font)
        self.lineEdit_IP_vide.setObjectName("lineEdit_IP_vide")
        self.lineEdit_IP_vide.setVisible(False)
        self.lineEdit_masque_vide = QtGui.QLineEdit(Dialog)
        self.lineEdit_masque_vide.setGeometry(QtCore.QRect(1010, 420, 141, 31))
        font = QtGui.QFont()
        font.setFamily("Bitstream Charter")
        font.setPointSize(14)
        self.lineEdit_masque_vide.setFont(font)
        self.lineEdit_masque_vide.setObjectName("lineEdit_masque_vide")
        self.lineEdit_masque_vide.setVisible(False)
        self.lineEdit_CLE = QtGui.QLineEdit(Dialog)
        self.lineEdit_CLE.setGeometry(QtCore.QRect(1140, 360, 51, 36))
        font = QtGui.QFont()
        font.setFamily("Bitstream Charter")
        font.setPointSize(14)

        self.lineEdit_CLE.setFont(font)
        self.lineEdit_CLE.setAlignment(QtCore.Qt.AlignCenter)
        self.lineEdit_CLE.setReadOnly(True)
        self.lineEdit_CLE.setObjectName("lineEdit_CLE")
        self.lineEdit_CLE.setVisible(False)
        self.lineEdit_CLE_vide = QtGui.QLineEdit(Dialog)
        self.lineEdit_CLE_vide.setGeometry(QtCore.QRect(1210, 360, 121, 31))
        font = QtGui.QFont()
        font.setFamily("Bitstream Charter")
        font.setPointSize(14)
        self.lineEdit_CLE_vide.setFont(font)
        self.lineEdit_CLE_vide.setObjectName("lineEdit_CLE_vide")
        self.lineEdit_CLE_vide.setVisible(False)



        self.retranslateUi(Dialog)
        QtCore.QObject.connect(self.radioButton_fixe, QtCore.SIGNAL("clicked()"), self.fixe)
        QtCore.QObject.connect(self.radioButton_mobile, QtCore.SIGNAL("clicked()"), self.mobile)
        QtCore.QObject.connect(self.pushButton_Nouvel_AP, QtCore.SIGNAL("clicked()"), Dialog.accept)
        QtCore.QObject.connect(self.pushButton_precedent, QtCore.SIGNAL("clicked()"), self.retour)
        QtCore.QObject.connect(self.pushButton_suivant, QtCore.SIGNAL("clicked()"), self.suivant)
	QtCore.QObject.connect(self.comboBox_AP_existants, QtCore.SIGNAL("activated(QString)"), self.displayAccessPoint)
        QtCore.QObject.connect(self.comboBox_dhcp, QtCore.SIGNAL("activated(QString)"), self.dhcp)
        QtCore.QObject.connect(self.comboBox_cryptage, QtCore.SIGNAL("activated(QString)"), self.cryptage)
        QtCore.QMetaObject.connectSlotsByName(Dialog)

    def retranslateUi(self, Dialog):
        Dialog.setWindowTitle(QtGui.QApplication.translate("Dialog", "Dialog", None, QtGui.QApplication.UnicodeUTF8))
        self.lineEdit_access_point.setText(QtGui.QApplication.translate("Dialog", "ACCESS POINT", None, QtGui.QApplication.UnicodeUTF8))
        self.lineEdit_coordonnees_relatives.setText(QtGui.QApplication.translate("Dialog", "Coordonnées relatives :", None, QtGui.QApplication.UnicodeUTF8))
        self.lineEdit_desc_ap.setText(QtGui.QApplication.translate("Dialog", "Description de la situation géographique de l\'access point :", None, QtGui.QApplication.UnicodeUTF8))
        self.pushButton_suivant.setText(QtGui.QApplication.translate("Dialog", "Suivant >>", None, QtGui.QApplication.UnicodeUTF8))
        self.lineEdit_x.setText(QtGui.QApplication.translate("Dialog", "X :", None, QtGui.QApplication.UnicodeUTF8))
        self.lineEdit_y.setText(QtGui.QApplication.translate("Dialog", "Y :", None, QtGui.QApplication.UnicodeUTF8))
        self.lineEdit_z.setText(QtGui.QApplication.translate("Dialog", "Z :", None, QtGui.QApplication.UnicodeUTF8))
        self.pushButton_precedent.setText(QtGui.QApplication.translate("Dialog", "<< Précédent", None, QtGui.QApplication.UnicodeUTF8))
        self.lineEdit_adresse_mac.setText(QtGui.QApplication.translate("Dialog", "Adresse MAC :", None, QtGui.QApplication.UnicodeUTF8))
        self.lineEdit_nouvel_AP.setText(QtGui.QApplication.translate("Dialog", "Nouveau Point d\'Accès", None, QtGui.QApplication.UnicodeUTF8))
        self.lineEdit_AP_existants.setText(QtGui.QApplication.translate("Dialog", "Points d\'Accès Existants", None, QtGui.QApplication.UnicodeUTF8))
        self.pushButton_Nouvel_AP.setText(QtGui.QApplication.translate("Dialog", "Créer ce point d\'accès", None, QtGui.QApplication.UnicodeUTF8))
        self.lineEdit_type.setText(QtGui.QApplication.translate("Dialog", "Type :", None, QtGui.QApplication.UnicodeUTF8))
        self.radioButton_fixe.setText(QtGui.QApplication.translate("Dialog", "Fixe", None, QtGui.QApplication.UnicodeUTF8))
        self.radioButton_mobile.setText(QtGui.QApplication.translate("Dialog", "Mobile", None, QtGui.QApplication.UnicodeUTF8))
        self.lineEdit_emplacement.setText(QtGui.QApplication.translate("Dialog", "Choix de l\'emplacement de référence :", None, QtGui.QApplication.UnicodeUTF8))
        self.lineEdit_essid.setText(QtGui.QApplication.translate("Dialog", "ESSID :", None, QtGui.QApplication.UnicodeUTF8))
        self.lineEdit_cryptage.setText(QtGui.QApplication.translate("Dialog", "CRYPTAGE :", None, QtGui.QApplication.UnicodeUTF8))
        self.lineEdit_dhcp.setText(QtGui.QApplication.translate("Dialog", "DHCP :", None, QtGui.QApplication.UnicodeUTF8))
        self.lineEdit_nom.setText(QtGui.QApplication.translate("Dialog", "NOM :", None, QtGui.QApplication.UnicodeUTF8))
        self.lineEdit_IP.setText(QtGui.QApplication.translate("Dialog", "IP :", None, QtGui.QApplication.UnicodeUTF8))
        self.lineEdit_masque.setText(QtGui.QApplication.translate("Dialog", "MASQUE :", None, QtGui.QApplication.UnicodeUTF8))
        self.lineEdit_CLE.setText(QtGui.QApplication.translate("Dialog", "CLE :", None, QtGui.QApplication.UnicodeUTF8))
